﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace _05_事件
{
    /// <summary>
    /// _02_鼠标事件.xaml 的交互逻辑
    /// </summary>
    public partial class _02_鼠标事件 : Window
    {
        public _02_鼠标事件()
        {
            InitializeComponent();
        }
        private bool flag=false;

        private void Grid_MouseMove(object sender, MouseEventArgs e)
        {
            if (flag)
            {
                Point pt = e.GetPosition(this);
                txtPointInfo.Text = $"横坐标为{pt.X},纵坐标{pt.Y}";
            }
       
        }

        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.flag = true;
        }

        private void Grid_MouseUp(object sender, MouseButtonEventArgs e)
        {
            this.flag &= false;
        }
    }
}
